package SwingView.Lecture;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

import JDBC.InstructorLectureActivities;
import JDBC.StudentLectureActivities;
import SwingController.CmsPresenter;
import SwingModel.CmsInstructor;
import SwingModel.CmsLecture;
import SwingModel.CmsStudent;
import SwingModel.CmsUser;
import SwingView.CmsCPPeople;
import SwingView.CmsMainView;
import SwingView.CmsPageSelector.CmsPage;

public class ALLecture implements ActionListener{

	//---------------------------------------------------------
	//PERFORMING ACTION:
	//---------------------------------------------------------		
	@Override
	public void actionPerformed(ActionEvent e){
		
		CmsUser user = CmsPresenter.user;
		CmsMainView mainView = CmsPresenter.mainView;
		
		List<CmsLecture> listOfLecture;
		
		//.....................................................
		//INSTRUCTOR CASE:
		if (user instanceof CmsInstructor){
			listOfLecture = InstructorLectureActivities.getListOfLecture(user.getUsername(), user.getSelectedCourse().getCourseID());
			mainView.displayLectureInstructorPage(listOfLecture);
		}
		
		//.....................................................
		//STUDENT CASE:
		else{//Student case
			listOfLecture = StudentLectureActivities.getListOfLecture(user.getSelectedCourse().getCourseID());
			mainView.displayLectureStudentPage(listOfLecture);
		}
		
	}

}
